<template>
  <div style="padding: 0px;margin: 0px;">
    <v-login v-if="mShowLogin" style="padding: 0px;margin: 0px;"></v-login>
    <v-main v-if="mShowMain" style="padding: 0px;margin: 0px;"></v-main>
  </div>
</template>

<style>
</style>

<script>
import {
  getRequestHeader,
  loginApi,
  checkLoginStatusApi
} from "../api/user.js";
import { getNowFormatDate, getWeekToday } from "../api/util.js";
import Login from "./Login.vue";
import Main from "./Main.vue";
export default {
  data() {
    return {
      mUserName: "",
      mPassword: "",
      config: undefined,
      mToday: "",
      noticeList: [],
      animate: false,
      intNum: undefined,
      mCurrentVV: undefined,
      mPalyer: undefined,
      mShowLogin: false,
      mShowMain: true
    };
  },
  created() {
    this.checkLoginStatus()
  },
  mounted() {},
  components: {
    /* 前面的组件名称不能和HTML标签一样*/
    "v-login": Login, //挂载新闻组件
    "v-main": Main //挂载新闻组件
  },
  computed: {
    classOption() {
      return {
        singleHeight: 100,
        waitTime: 500,
        step: 1,
        hoverStop: false,
        limitMoveNum: 1
      };
    },
    classOption1() {
      return {
        singleHeight: 100,
        waitTime: 500,
        step: 1,
        hoverStop: false,
        limitMoveNum: 1
      };
    }
  },
  methods: {
    showMainPage() {
      this.mShowLogin = false;
      this.mShowMain = true;
    },
    checkLoginStatus() {
      var that = this;
      checkLoginStatusApi(
        getRequestHeader(),
        new (function() {
          this.success = function(data) {
            that.showMainPage();
          };
          this.fail = function(msg) {};
        })()
      );
    }
  }
};
</script>